/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "nota_credito")
@NamedQueries({
    @NamedQuery(name = "NotaCredito.findAll", query = "SELECT n FROM NotaCredito n")})
public class NotaCredito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nro_nota")
    private Integer nroNota;
    @Basic(optional = false)
    @Column(name = "fecha_emision")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaEmision;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "importe_total")
    private BigDecimal importeTotal;
    @Basic(optional = false)
    @Column(name = "concepto")
    private String concepto;
    @Basic(optional = false)
    @Column(name = "costo_disminucion")
    private BigDecimal costoDisminucion;
    @JoinColumn(name = "nro_factura", referencedColumnName = "nro_factura")
    @ManyToOne
    private Factura nroFactura;

    public NotaCredito() {
    }

    public NotaCredito(Integer nroNota) {
        this.nroNota = nroNota;
    }

    public NotaCredito(Integer nroNota, Date fechaEmision, BigDecimal importeTotal, String concepto, BigDecimal costoDisminucion) {
        this.nroNota = nroNota;
        this.fechaEmision = fechaEmision;
        this.importeTotal = importeTotal;
        this.concepto = concepto;
        this.costoDisminucion = costoDisminucion;
    }

    public Integer getNroNota() {
        return nroNota;
    }

    public void setNroNota(Integer nroNota) {
        this.nroNota = nroNota;
    }

    public Date getFechaEmision() {
        return fechaEmision;
    }

    public void setFechaEmision(Date fechaEmision) {
        this.fechaEmision = fechaEmision;
    }

    public BigDecimal getImporteTotal() {
        return importeTotal;
    }

    public void setImporteTotal(BigDecimal importeTotal) {
        this.importeTotal = importeTotal;
    }

    public String getConcepto() {
        return concepto;
    }

    public void setConcepto(String concepto) {
        this.concepto = concepto;
    }

    public BigDecimal getCostoDisminucion() {
        return costoDisminucion;
    }

    public void setCostoDisminucion(BigDecimal costoDisminucion) {
        this.costoDisminucion = costoDisminucion;
    }

    public Factura getNroFactura() {
        return nroFactura;
    }

    public void setNroFactura(Factura nroFactura) {
        this.nroFactura = nroFactura;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nroNota != null ? nroNota.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NotaCredito)) {
            return false;
        }
        NotaCredito other = (NotaCredito) object;
        if ((this.nroNota == null && other.nroNota != null) || (this.nroNota != null && !this.nroNota.equals(other.nroNota))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.NotaCredito[ nroNota=" + nroNota + " ]";
    }
    
}
